<?php
/*
 * @Created by: wangchengcheng
 * @Author: wangchengcheng
 * @Date: 2020-01-01 20:32:34
 * @LastEditors  : wangchengcheng
 * @LastEditTime : 2020-01-20 11:23:49
 */

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Carbon;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        if($this->app->environment() !== 'production'){
            //ide
            $this->app->register(\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class);
            //调试 工具
            $this->app->register(\Clockwork\Support\Laravel\ClockworkServiceProvider::class);
        }
    }

    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        ini_set('memory_limit', '512M');

        $local = config('app.locale');
        app('translator')->setLocale($local);
        Carbon::setlocale($local);

        Carbon::serializeUsing(function(Carbon $timestamp){
            return $timestamp->format('Y-m-d H:i:s');
        });
    }
}
